//
//  AYStatusCell.swift
//  iOSSinaWeb
//
//  Created by yws on 16/5/18.
//  Copyright © 2016年 yws. All rights reserved.
//

import UIKit
import SnapKit
class AYStatusCell: UITableViewCell {
    
    
    var status:AYStatus? {
        didSet{
            originalView.status = status
//            AMPrint(items: "status-----\(status)")
            retweeView.retweetStatus = status?.retweeted_status
        }
    }
    
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    

    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        
        preparUI()
    }
    
    // MARK: - 布局
    
    private func preparUI() {
        backgroundColor = UIColor(white: 237 / 255.0, alpha: 1)

        contentView.addSubview(originalView)
        contentView.addSubview(retweeView)
        contentView.addSubview(bottomView)
        
        ///content的布局
        originalView.snp_makeConstraints { (make) in
            make.top.equalTo(contentView).offset(10)
            make.leading.equalTo(contentView)
            make.trailing.equalTo(contentView)
        }
        
        
        retweeView.snp_makeConstraints { (make) in
            make.top.equalTo(originalView.snp_bottom)
            make.leading.equalTo(contentView)
            make.trailing.equalTo(contentView)
            //测试转发View用的
//            make.height.equalTo(50)
        }
        
        
        bottomView.snp_makeConstraints { (make) in
            make.top.equalTo(retweeView.snp_bottom)
            make.trailing.equalTo(contentView)
            make.leading.equalTo(contentView)
            make.height.equalTo(37)
        }

        
        contentView.snp_makeConstraints { (make) in
            make.leading.equalTo(self)
            make.trailing.equalTo(self)
            make.top.equalTo(self)
            make.bottom.equalTo(bottomView)

        }
        
        
        
    }
    
    // MARK: - lazy
    private lazy var originalView: AYStatusOriginalView = AYStatusOriginalView()
    
    private lazy var bottomView: AYStatusBottomView = AYStatusBottomView()
    
    private lazy var retweeView:AYStatusRetweetView = AYStatusRetweetView()
    
   
    
}
